Fixed rich text sorting order issue when used together with Sorting2D component#19084
Closed
raduangelescu wants to merge 2 commits intococos:v3.8.8from
Closed
Fixed rich text sorting order issue when used together with Sorting2D component#19084raduangelescu wants to merge 2 commits intococos:v3.8.8from
raduangelescu wants to merge 2 commits intococos:v3.8.8from
Conversation
Code Size Check Report
Interface Check Report! WARNING this pull request has changed these public interfaces:
@@ -3035,9 +3035,13 @@
protected _layoutDirty: boolean;
protected _lineOffsetX: number;
protected _updateRichTextStatus: () => void;
protected _labelChildrenNum: number;
+ protected _currentSortingLayer: number;
+ protected _currentSortingOrder: number;
+ protected _sorting2d: Sorting2D | null;
constructor();
+ protected __preload(): void;
onLoad(): void;
onEnable(): void;
onDisable(): void;
onRestore(): void;
@@ -3066,8 +3070,9 @@
protected _convertLiteralColorValue(color: string): math.Color;
protected _applyTextAttribute(labelSeg: __private._cocos_2d_components_rich_text__ISegment): void;
protected _applyLayer(): void;
protected _resetLabelState(label: Label): void;
+ protected update(dt: number): void;
}
/**
* @en
* Graphics component.
|
Greptile found no issues!From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The RichText component was creating label and Sprite nodes that did not propagate the Sorting2D component that the RichText had. This resulted in incorrect render orders for rich text because all it's child nodes would render on the default layer with 0 sorting order.
This pull request fixes this issue: #19015
Example project archive:
richtextbadlayer_example.zip
Example of issue:

layer setup:
Before fix:

After fix:

Re: #
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request:
Greptile Summary
Important Files Changed
cocos/2d/components/rich-text.tscocos/gfx/webgl2/webgl2-commands.tscocos/gfx/webgl/webgl-commands.tscocos/gfx/webgl2/webgl2-gpu-objects.tscocos/gfx/webgl/webgl-gpu-objects.tsConfidence score: 4/5
Sequence Diagram
sequenceDiagram participant User participant WebGL2CmdFuncUpdateBuffer participant Device participant GL as "WebGL Context" participant VAO as "VAO Cache" participant IA as "Input Assembler" User->>WebGL2CmdFuncUpdateBuffer: "Update buffer data" WebGL2CmdFuncUpdateBuffer->>Device: "Check if iOS" alt iOS Platform WebGL2CmdFuncUpdateBuffer->>WebGL2CmdFuncUpdateBuffer: "Increment updateVersion++" WebGL2CmdFuncUpdateBuffer->>VAO: "Unbind current VAO" WebGL2CmdFuncUpdateBuffer->>GL: "gl.bindVertexArray(null)" WebGL2CmdFuncUpdateBuffer->>IA: "Invalidate input assembler cache" end WebGL2CmdFuncUpdateBuffer->>GL: "Bind target buffer" WebGL2CmdFuncUpdateBuffer->>GL: "gl.bufferSubData() or gl.bufferData()" Note over User,IA: Later during rendering... User->>WebGL2CmdFuncBindStates: "Bind rendering states" WebGL2CmdFuncBindStates->>Device: "Check if iOS and VAO needed" alt iOS Platform and VAO Required WebGL2CmdFuncBindStates->>WebGL2CmdFuncBindStates: "Compute current buffer versions" WebGL2CmdFuncBindStates->>VAO: "Check cached VAO version" alt Version Mismatch WebGL2CmdFuncBindStates->>GL: "Delete old VAO" WebGL2CmdFuncBindStates->>GL: "Create new VAO" WebGL2CmdFuncBindStates->>VAO: "Store new version hash" end end WebGL2CmdFuncBindStates->>GL: "Bind VAO for rendering"